package SortHelper;

import java.sql.Array;
import java.util.Arrays;
import java.util.Random;

public class ArrayGenerator {

    private ArrayGenerator(){}

    public static int n;

    //生成n个数的有序数组，并且数字从0开始
    public static Integer[] generateOrderedArray(int n){
        Integer[] arr = new Integer[n];
        for (int i = 0; i < n; i++) {
            arr[i] = n;
        }
        return arr;
    }

    //生成n个随机数的数组，数字限制在（-bound,+bound），数量在为n
    public static Integer[] generateRandomArray(int n ,int bound){
        Integer[] arr = new Integer[n];
        Random rnd = new Random();
        for (int i = 0; i < n; i++) {
            arr[i] = rnd.nextInt(bound)-rnd.nextInt(bound);
        }
        return arr;
    }

    //生成n个随机数的数组,并且排好序，数字限制在（-bound,+bound），数量在为n
    public static Integer[] generateOrderRandomArray(int n,int bound){
        Integer[] arr = generateRandomArray(n,bound);
        Arrays.sort(arr);
        return arr;
    }
}
